package o;

import android.annotation.SuppressLint;
import android.annotation.TargetApi;
import android.content.res.ColorStateList;
import android.content.res.Resources;
import android.content.res.Resources.Theme;
import android.graphics.Canvas;
import android.graphics.ColorFilter;
import android.graphics.Outline;
import android.graphics.PorterDuff.Mode;
import android.graphics.Rect;
import android.graphics.drawable.Drawable;
import android.graphics.drawable.Drawable.Callback;
import android.graphics.drawable.Drawable.ConstantState;
import android.os.Build.VERSION;
import android.os.SystemClock;
import android.util.SparseArray;
import androidx.annotation.NonNull;
import androidx.annotation.Nullable;
import androidx.annotation.RequiresApi;
import androidx.annotation.RestrictTo;

@RestrictTo({androidx.annotation.RestrictTo.d.ˊ})
class as extends Drawable implements Callback {
    private int ʻ = -1;
    private boolean ʼ;
    private int ʽ = -1;
    private Drawable ˊ;
    private d ˋ;
    private c ˋॱ;
    private Rect ˎ;
    private Drawable ˏ;
    private long ˏॱ;
    private int ॱ = 255;
    private long ॱˊ;
    private Runnable ॱॱ;
    private boolean ᐝ;

    static abstract class d extends ConstantState {
        int ʻ;
        int ʻॱ;
        SparseArray<ConstantState> ʼ;
        boolean ʼॱ;
        int ʽ;
        boolean ʽॱ;
        boolean ʾ;
        boolean ʿ;
        int ˈ;
        boolean ˉ;
        Resources ˊ;
        int ˊˊ = 0;
        int ˊˋ = 0;
        boolean ˊॱ;
        int ˊᐝ;
        boolean ˋˊ = true;
        boolean ˋˋ;
        boolean ˋॱ = false;
        boolean ˋᐝ;
        ColorStateList ˌ;
        Mode ˍ;
        ColorFilter ˎˎ;
        final as ˏ;
        Rect ˏॱ;
        boolean ˑ;
        boolean ͺ;
        boolean ͺॱ;
        int ॱ = 160;
        boolean ॱˊ = false;
        int ॱˋ;
        int ॱˎ;
        int ॱॱ;
        int ॱᐝ;
        Drawable[] ᐝ;
        boolean ᐝॱ;

        d(d dVar, as asVar, Resources resources) {
            int i;
            int i2 = 0;
            this.ˏ = asVar;
            Resources resources2 = resources != null ? resources : dVar != null ? dVar.ˊ : null;
            this.ˊ = resources2;
            if (dVar != null) {
                i = dVar.ॱ;
            } else {
                i = 0;
            }
            this.ॱ = as.ˎ(resources, i);
            if (dVar != null) {
                this.ʽ = dVar.ʽ;
                this.ʻ = dVar.ʻ;
                this.ʼॱ = true;
                this.ʽॱ = true;
                this.ˋॱ = dVar.ˋॱ;
                this.ॱˊ = dVar.ॱˊ;
                this.ˋˊ = dVar.ˋˊ;
                this.ˉ = dVar.ˉ;
                this.ˊᐝ = dVar.ˊᐝ;
                this.ˊˋ = dVar.ˊˋ;
                this.ˊˊ = dVar.ˊˊ;
                this.ˋᐝ = dVar.ˋᐝ;
                this.ˎˎ = dVar.ˎˎ;
                this.ˋˋ = dVar.ˋˋ;
                this.ˌ = dVar.ˌ;
                this.ˍ = dVar.ˍ;
                this.ͺॱ = dVar.ͺॱ;
                this.ˑ = dVar.ˑ;
                if (dVar.ॱ == this.ॱ) {
                    if (dVar.ͺ) {
                        this.ˏॱ = new Rect(dVar.ˏॱ);
                        this.ͺ = true;
                    }
                    if (dVar.ˊॱ) {
                        this.ॱᐝ = dVar.ॱᐝ;
                        this.ॱˎ = dVar.ॱˎ;
                        this.ʻॱ = dVar.ʻॱ;
                        this.ॱˋ = dVar.ॱˋ;
                        this.ˊॱ = true;
                    }
                }
                if (dVar.ᐝॱ) {
                    this.ˈ = dVar.ˈ;
                    this.ᐝॱ = true;
                }
                if (dVar.ʾ) {
                    this.ʿ = dVar.ʿ;
                    this.ʾ = true;
                }
                Drawable[] drawableArr = dVar.ᐝ;
                this.ᐝ = new Drawable[drawableArr.length];
                this.ॱॱ = dVar.ॱॱ;
                SparseArray sparseArray = dVar.ʼ;
                if (sparseArray != null) {
                    this.ʼ = sparseArray.clone();
                } else {
                    this.ʼ = new SparseArray(this.ॱॱ);
                }
                int i3 = this.ॱॱ;
                while (i2 < i3) {
                    if (drawableArr[i2] != null) {
                        ConstantState constantState = drawableArr[i2].getConstantState();
                        if (constantState != null) {
                            this.ʼ.put(i2, constantState);
                        } else {
                            this.ᐝ[i2] = drawableArr[i2];
                        }
                    }
                    i2++;
                }
                return;
            }
            this.ᐝ = new Drawable[10];
            this.ॱॱ = 0;
        }

        public int getChangingConfigurations() {
            return this.ʽ | this.ʻ;
        }

        public final int ˋ(Drawable drawable) {
            int i = this.ॱॱ;
            if (i >= this.ᐝ.length) {
                ˋ(i, i + 10);
            }
            drawable.mutate();
            drawable.setVisible(false, true);
            drawable.setCallback(this.ˏ);
            this.ᐝ[i] = drawable;
            this.ॱॱ++;
            this.ʻ |= drawable.getChangingConfigurations();
            ˎ();
            this.ˏॱ = null;
            this.ͺ = false;
            this.ˊॱ = false;
            this.ʼॱ = false;
            return i;
        }

        void ˎ() {
            this.ᐝॱ = false;
            this.ʾ = false;
        }

        final int ˊ() {
            return this.ᐝ.length;
        }

        private void ॱˊ() {
            if (this.ʼ != null) {
                int size = this.ʼ.size();
                for (int i = 0; i < size; i++) {
                    this.ᐝ[this.ʼ.keyAt(i)] = ˎ(((ConstantState) this.ʼ.valueAt(i)).newDrawable(this.ˊ));
                }
                this.ʼ = null;
            }
        }

        private Drawable ˎ(Drawable drawable) {
            if (VERSION.SDK_INT >= 23) {
                drawable.setLayoutDirection(this.ˊᐝ);
            }
            Drawable mutate = drawable.mutate();
            mutate.setCallback(this.ˏ);
            return mutate;
        }

        public final int ˋ() {
            return this.ॱॱ;
        }

        public final Drawable ˊ(int i) {
            Drawable drawable = this.ᐝ[i];
            if (drawable != null) {
                return drawable;
            }
            if (this.ʼ != null) {
                int indexOfKey = this.ʼ.indexOfKey(i);
                if (indexOfKey >= 0) {
                    drawable = ˎ(((ConstantState) this.ʼ.valueAt(indexOfKey)).newDrawable(this.ˊ));
                    this.ᐝ[i] = drawable;
                    this.ʼ.removeAt(indexOfKey);
                    if (this.ʼ.size() != 0) {
                        return drawable;
                    }
                    this.ʼ = null;
                    return drawable;
                }
            }
            return null;
        }

        final boolean ˊ(int i, int i2) {
            int i3 = this.ॱॱ;
            Drawable[] drawableArr = this.ᐝ;
            int i4 = 0;
            boolean z = false;
            while (i4 < i3) {
                boolean layoutDirection;
                if (drawableArr[i4] != null) {
                    if (VERSION.SDK_INT >= 23) {
                        layoutDirection = drawableArr[i4].setLayoutDirection(i);
                    } else {
                        layoutDirection = false;
                    }
                    if (i4 == i2) {
                        i4++;
                        z = layoutDirection;
                    }
                }
                layoutDirection = z;
                i4++;
                z = layoutDirection;
            }
            this.ˊᐝ = i;
            return z;
        }

        final void ˏ(Resources resources) {
            if (resources != null) {
                this.ˊ = resources;
                int ˎ = as.ˎ(resources, this.ॱ);
                int i = this.ॱ;
                this.ॱ = ˎ;
                if (i != ˎ) {
                    this.ˊॱ = false;
                    this.ͺ = false;
                }
            }
        }

        @RequiresApi(21)
        final void ˎ(Theme theme) {
            if (theme != null) {
                ॱˊ();
                int i = this.ॱॱ;
                Drawable[] drawableArr = this.ᐝ;
                int i2 = 0;
                while (i2 < i) {
                    if (drawableArr[i2] != null && drawableArr[i2].canApplyTheme()) {
                        drawableArr[i2].applyTheme(theme);
                        this.ʻ |= drawableArr[i2].getChangingConfigurations();
                    }
                    i2++;
                }
                ˏ(theme.getResources());
            }
        }

        @RequiresApi(21)
        public boolean canApplyTheme() {
            int i = this.ॱॱ;
            Drawable[] drawableArr = this.ᐝ;
            for (int i2 = 0; i2 < i; i2++) {
                Drawable drawable = drawableArr[i2];
                if (drawable == null) {
                    ConstantState constantState = (ConstantState) this.ʼ.get(i2);
                    if (constantState != null && constantState.canApplyTheme()) {
                        return true;
                    }
                } else if (drawable.canApplyTheme()) {
                    return true;
                }
            }
            return false;
        }

        void ˏ() {
            int i = this.ॱॱ;
            Drawable[] drawableArr = this.ᐝ;
            for (int i2 = 0; i2 < i; i2++) {
                if (drawableArr[i2] != null) {
                    drawableArr[i2].mutate();
                }
            }
            this.ˉ = true;
        }

        public final void ˎ(boolean z) {
            this.ˋॱ = z;
        }

        public final Rect ॱ() {
            Rect rect = null;
            if (this.ˋॱ) {
                return null;
            }
            if (this.ˏॱ != null || this.ͺ) {
                return this.ˏॱ;
            }
            ॱˊ();
            Rect rect2 = new Rect();
            int i = this.ॱॱ;
            Drawable[] drawableArr = this.ᐝ;
            for (int i2 = 0; i2 < i; i2++) {
                if (drawableArr[i2].getPadding(rect2)) {
                    if (rect == null) {
                        rect = new Rect(0, 0, 0, 0);
                    }
                    if (rect2.left > rect.left) {
                        rect.left = rect2.left;
                    }
                    if (rect2.top > rect.top) {
                        rect.top = rect2.top;
                    }
                    if (rect2.right > rect.right) {
                        rect.right = rect2.right;
                    }
                    if (rect2.bottom > rect.bottom) {
                        rect.bottom = rect2.bottom;
                    }
                }
            }
            this.ͺ = true;
            this.ˏॱ = rect;
            return rect;
        }

        public final void ˋ(boolean z) {
            this.ॱˊ = z;
        }

        public final boolean ʼ() {
            return this.ॱˊ;
        }

        public final int ᐝ() {
            if (!this.ˊॱ) {
                ˋॱ();
            }
            return this.ॱᐝ;
        }

        public final int ʽ() {
            if (!this.ˊॱ) {
                ˋॱ();
            }
            return this.ॱˎ;
        }

        public final int ॱॱ() {
            if (!this.ˊॱ) {
                ˋॱ();
            }
            return this.ʻॱ;
        }

        public final int ʻ() {
            if (!this.ˊॱ) {
                ˋॱ();
            }
            return this.ॱˋ;
        }

        protected void ˋॱ() {
            int i = 0;
            this.ˊॱ = true;
            ॱˊ();
            int i2 = this.ॱॱ;
            Drawable[] drawableArr = this.ᐝ;
            this.ॱˎ = -1;
            this.ॱᐝ = -1;
            this.ॱˋ = 0;
            this.ʻॱ = 0;
            while (i < i2) {
                Drawable drawable = drawableArr[i];
                int intrinsicWidth = drawable.getIntrinsicWidth();
                if (intrinsicWidth > this.ॱᐝ) {
                    this.ॱᐝ = intrinsicWidth;
                }
                intrinsicWidth = drawable.getIntrinsicHeight();
                if (intrinsicWidth > this.ॱˎ) {
                    this.ॱˎ = intrinsicWidth;
                }
                intrinsicWidth = drawable.getMinimumWidth();
                if (intrinsicWidth > this.ʻॱ) {
                    this.ʻॱ = intrinsicWidth;
                }
                int minimumHeight = drawable.getMinimumHeight();
                if (minimumHeight > this.ॱˋ) {
                    this.ॱˋ = minimumHeight;
                }
                i++;
            }
        }

        public final void ˋ(int i) {
            this.ˊˋ = i;
        }

        public final void ˎ(int i) {
            this.ˊˊ = i;
        }

        public final int ͺ() {
            if (this.ᐝॱ) {
                return this.ˈ;
            }
            ॱˊ();
            int i = this.ॱॱ;
            Drawable[] drawableArr = this.ᐝ;
            int opacity = i > 0 ? drawableArr[0].getOpacity() : -2;
            int i2 = 1;
            while (i2 < i) {
                int resolveOpacity = Drawable.resolveOpacity(opacity, drawableArr[i2].getOpacity());
                i2++;
                opacity = resolveOpacity;
            }
            this.ˈ = opacity;
            this.ᐝॱ = true;
            return opacity;
        }

        public final boolean ˏॱ() {
            boolean z = false;
            if (this.ʾ) {
                return this.ʿ;
            }
            ॱˊ();
            int i = this.ॱॱ;
            Drawable[] drawableArr = this.ᐝ;
            for (int i2 = 0; i2 < i; i2++) {
                if (drawableArr[i2].isStateful()) {
                    z = true;
                    break;
                }
            }
            this.ʿ = z;
            this.ʾ = true;
            return z;
        }

        public void ˋ(int i, int i2) {
            Object obj = new Drawable[i2];
            System.arraycopy(this.ᐝ, 0, obj, 0, i);
            this.ᐝ = obj;
        }

        public synchronized boolean ˊॱ() {
            boolean z = false;
            synchronized (this) {
                if (this.ʼॱ) {
                    z = this.ʽॱ;
                } else {
                    ॱˊ();
                    this.ʼॱ = true;
                    int i = this.ॱॱ;
                    Drawable[] drawableArr = this.ᐝ;
                    for (int i2 = 0; i2 < i; i2++) {
                        if (drawableArr[i2].getConstantState() == null) {
                            this.ʽॱ = false;
                            break;
                        }
                    }
                    this.ʽॱ = true;
                    z = true;
                }
            }
            return z;
        }
    }

    static class c implements Callback {
        private Callback ˋ;

        c() {
        }

        public c ॱ(Callback callback) {
            this.ˋ = callback;
            return this;
        }

        public Callback ˏ() {
            Callback callback = this.ˋ;
            this.ˋ = null;
            return callback;
        }

        public void invalidateDrawable(@NonNull Drawable drawable) {
        }

        public void scheduleDrawable(@NonNull Drawable drawable, @NonNull Runnable runnable, long j) {
            if (this.ˋ != null) {
                this.ˋ.scheduleDrawable(drawable, runnable, j);
            }
        }

        public void unscheduleDrawable(@NonNull Drawable drawable, @NonNull Runnable runnable) {
            if (this.ˋ != null) {
                this.ˋ.unscheduleDrawable(drawable, runnable);
            }
        }
    }

    as() {
    }

    public void draw(@NonNull Canvas canvas) {
        if (this.ˊ != null) {
            this.ˊ.draw(canvas);
        }
        if (this.ˏ != null) {
            this.ˏ.draw(canvas);
        }
    }

    public int getChangingConfigurations() {
        return super.getChangingConfigurations() | this.ˋ.getChangingConfigurations();
    }

    @SuppressLint({"WrongConstant"})
    @TargetApi(23)
    private boolean ˏ() {
        return isAutoMirrored() && getLayoutDirection() == 1;
    }

    public boolean getPadding(@NonNull Rect rect) {
        boolean z;
        Rect ॱ = this.ˋ.ॱ();
        if (ॱ != null) {
            rect.set(ॱ);
            z = (ॱ.right | ((ॱ.left | ॱ.top) | ॱ.bottom)) != 0;
        } else {
            z = this.ˊ != null ? this.ˊ.getPadding(rect) : super.getPadding(rect);
        }
        if (ˏ()) {
            int i = rect.left;
            rect.left = rect.right;
            rect.right = i;
        }
        return z;
    }

    @RequiresApi(21)
    public void getOutline(@NonNull Outline outline) {
        if (this.ˊ != null) {
            this.ˊ.getOutline(outline);
        }
    }

    public void setAlpha(int i) {
        if (!this.ᐝ || this.ॱ != i) {
            this.ᐝ = true;
            this.ॱ = i;
            if (this.ˊ == null) {
                return;
            }
            if (this.ˏॱ == 0) {
                this.ˊ.setAlpha(i);
            } else {
                ˋ(false);
            }
        }
    }

    public int getAlpha() {
        return this.ॱ;
    }

    public void setDither(boolean z) {
        if (this.ˋ.ˋˊ != z) {
            this.ˋ.ˋˊ = z;
            if (this.ˊ != null) {
                this.ˊ.setDither(this.ˋ.ˋˊ);
            }
        }
    }

    public void setColorFilter(ColorFilter colorFilter) {
        this.ˋ.ˋˋ = true;
        if (this.ˋ.ˎˎ != colorFilter) {
            this.ˋ.ˎˎ = colorFilter;
            if (this.ˊ != null) {
                this.ˊ.setColorFilter(colorFilter);
            }
        }
    }

    public void setTintList(ColorStateList colorStateList) {
        this.ˋ.ͺॱ = true;
        if (this.ˋ.ˌ != colorStateList) {
            this.ˋ.ˌ = colorStateList;
            gg.ॱ(this.ˊ, colorStateList);
        }
    }

    public void setTintMode(@NonNull Mode mode) {
        this.ˋ.ˑ = true;
        if (this.ˋ.ˍ != mode) {
            this.ˋ.ˍ = mode;
            gg.ˋ(this.ˊ, mode);
        }
    }

    protected void onBoundsChange(Rect rect) {
        if (this.ˏ != null) {
            this.ˏ.setBounds(rect);
        }
        if (this.ˊ != null) {
            this.ˊ.setBounds(rect);
        }
    }

    public boolean isStateful() {
        return this.ˋ.ˏॱ();
    }

    public void setAutoMirrored(boolean z) {
        if (this.ˋ.ˋᐝ != z) {
            this.ˋ.ˋᐝ = z;
            if (this.ˊ != null) {
                gg.ˏ(this.ˊ, this.ˋ.ˋᐝ);
            }
        }
    }

    public boolean isAutoMirrored() {
        return this.ˋ.ˋᐝ;
    }

    public void jumpToCurrentState() {
        Object obj = 1;
        Object obj2 = null;
        if (this.ˏ != null) {
            this.ˏ.jumpToCurrentState();
            this.ˏ = null;
            this.ʽ = -1;
            obj2 = 1;
        }
        if (this.ˊ != null) {
            this.ˊ.jumpToCurrentState();
            if (this.ᐝ) {
                this.ˊ.setAlpha(this.ॱ);
            }
        }
        if (this.ॱˊ != 0) {
            this.ॱˊ = 0;
            obj2 = 1;
        }
        if (this.ˏॱ != 0) {
            this.ˏॱ = 0;
        } else {
            obj = obj2;
        }
        if (obj != null) {
            invalidateSelf();
        }
    }

    public void setHotspot(float f, float f2) {
        if (this.ˊ != null) {
            gg.ˋ(this.ˊ, f, f2);
        }
    }

    public void setHotspotBounds(int i, int i2, int i3, int i4) {
        if (this.ˎ == null) {
            this.ˎ = new Rect(i, i2, i3, i4);
        } else {
            this.ˎ.set(i, i2, i3, i4);
        }
        if (this.ˊ != null) {
            gg.ˏ(this.ˊ, i, i2, i3, i4);
        }
    }

    public void getHotspotBounds(@NonNull Rect rect) {
        if (this.ˎ != null) {
            rect.set(this.ˎ);
        } else {
            super.getHotspotBounds(rect);
        }
    }

    protected boolean onStateChange(int[] iArr) {
        if (this.ˏ != null) {
            return this.ˏ.setState(iArr);
        }
        if (this.ˊ != null) {
            return this.ˊ.setState(iArr);
        }
        return false;
    }

    protected boolean onLevelChange(int i) {
        if (this.ˏ != null) {
            return this.ˏ.setLevel(i);
        }
        if (this.ˊ != null) {
            return this.ˊ.setLevel(i);
        }
        return false;
    }

    public boolean onLayoutDirectionChanged(int i) {
        return this.ˋ.ˊ(i, ॱ());
    }

    public int getIntrinsicWidth() {
        if (this.ˋ.ʼ()) {
            return this.ˋ.ᐝ();
        }
        return this.ˊ != null ? this.ˊ.getIntrinsicWidth() : -1;
    }

    public int getIntrinsicHeight() {
        if (this.ˋ.ʼ()) {
            return this.ˋ.ʽ();
        }
        return this.ˊ != null ? this.ˊ.getIntrinsicHeight() : -1;
    }

    public int getMinimumWidth() {
        if (this.ˋ.ʼ()) {
            return this.ˋ.ॱॱ();
        }
        return this.ˊ != null ? this.ˊ.getMinimumWidth() : 0;
    }

    public int getMinimumHeight() {
        if (this.ˋ.ʼ()) {
            return this.ˋ.ʻ();
        }
        return this.ˊ != null ? this.ˊ.getMinimumHeight() : 0;
    }

    public void invalidateDrawable(@NonNull Drawable drawable) {
        if (this.ˋ != null) {
            this.ˋ.ˎ();
        }
        if (drawable == this.ˊ && getCallback() != null) {
            getCallback().invalidateDrawable(this);
        }
    }

    public void scheduleDrawable(@NonNull Drawable drawable, @NonNull Runnable runnable, long j) {
        if (drawable == this.ˊ && getCallback() != null) {
            getCallback().scheduleDrawable(this, runnable, j);
        }
    }

    public void unscheduleDrawable(@NonNull Drawable drawable, @NonNull Runnable runnable) {
        if (drawable == this.ˊ && getCallback() != null) {
            getCallback().unscheduleDrawable(this, runnable);
        }
    }

    public boolean setVisible(boolean z, boolean z2) {
        boolean visible = super.setVisible(z, z2);
        if (this.ˏ != null) {
            this.ˏ.setVisible(z, z2);
        }
        if (this.ˊ != null) {
            this.ˊ.setVisible(z, z2);
        }
        return visible;
    }

    public int getOpacity() {
        if (this.ˊ == null || !this.ˊ.isVisible()) {
            return -2;
        }
        return this.ˋ.ͺ();
    }

    int ॱ() {
        return this.ʻ;
    }

    boolean ˎ(int i) {
        if (i == this.ʻ) {
            return false;
        }
        long uptimeMillis = SystemClock.uptimeMillis();
        if (this.ˋ.ˊˊ > 0) {
            if (this.ˏ != null) {
                this.ˏ.setVisible(false, false);
            }
            if (this.ˊ != null) {
                this.ˏ = this.ˊ;
                this.ʽ = this.ʻ;
                this.ॱˊ = ((long) this.ˋ.ˊˊ) + uptimeMillis;
            } else {
                this.ˏ = null;
                this.ʽ = -1;
                this.ॱˊ = 0;
            }
        } else if (this.ˊ != null) {
            this.ˊ.setVisible(false, false);
        }
        if (i < 0 || i >= this.ˋ.ॱॱ) {
            this.ˊ = null;
            this.ʻ = -1;
        } else {
            Drawable ˊ = this.ˋ.ˊ(i);
            this.ˊ = ˊ;
            this.ʻ = i;
            if (ˊ != null) {
                if (this.ˋ.ˊˋ > 0) {
                    this.ˏॱ = uptimeMillis + ((long) this.ˋ.ˊˋ);
                }
                ˊ(ˊ);
            }
        }
        if (!(this.ˏॱ == 0 && this.ॱˊ == 0)) {
            if (this.ॱॱ == null) {
                this.ॱॱ = new Runnable(this) {
                    final /* synthetic */ as ॱ;

                    {
                        this.ॱ = r1;
                    }

                    public void run() {
                        this.ॱ.ˋ(true);
                        this.ॱ.invalidateSelf();
                    }
                };
            } else {
                unscheduleSelf(this.ॱॱ);
            }
            ˋ(true);
        }
        invalidateSelf();
        return true;
    }

    private void ˊ(Drawable drawable) {
        if (this.ˋॱ == null) {
            this.ˋॱ = new c();
        }
        drawable.setCallback(this.ˋॱ.ॱ(drawable.getCallback()));
        try {
            if (this.ˋ.ˊˋ <= 0 && this.ᐝ) {
                drawable.setAlpha(this.ॱ);
            }
            if (this.ˋ.ˋˋ) {
                drawable.setColorFilter(this.ˋ.ˎˎ);
            } else {
                if (this.ˋ.ͺॱ) {
                    gg.ॱ(drawable, this.ˋ.ˌ);
                }
                if (this.ˋ.ˑ) {
                    gg.ˋ(drawable, this.ˋ.ˍ);
                }
            }
            drawable.setVisible(isVisible(), true);
            drawable.setDither(this.ˋ.ˋˊ);
            drawable.setState(getState());
            drawable.setLevel(getLevel());
            drawable.setBounds(getBounds());
            if (VERSION.SDK_INT >= 23) {
                drawable.setLayoutDirection(getLayoutDirection());
            }
            if (VERSION.SDK_INT >= 19) {
                drawable.setAutoMirrored(this.ˋ.ˋᐝ);
            }
            Rect rect = this.ˎ;
            if (VERSION.SDK_INT >= 21 && rect != null) {
                drawable.setHotspotBounds(rect.left, rect.top, rect.right, rect.bottom);
            }
            drawable.setCallback(this.ˋॱ.ˏ());
        } catch (Throwable th) {
            drawable.setCallback(this.ˋॱ.ˏ());
        }
    }

    void ˋ(boolean z) {
        boolean z2;
        this.ᐝ = true;
        long uptimeMillis = SystemClock.uptimeMillis();
        if (this.ˊ != null) {
            if (this.ˏॱ != 0) {
                if (this.ˏॱ <= uptimeMillis) {
                    this.ˊ.setAlpha(this.ॱ);
                    this.ˏॱ = 0;
                    z2 = false;
                } else {
                    this.ˊ.setAlpha(((255 - (((int) ((this.ˏॱ - uptimeMillis) * 255)) / this.ˋ.ˊˋ)) * this.ॱ) / 255);
                    z2 = true;
                }
            }
            z2 = false;
        } else {
            this.ˏॱ = 0;
            z2 = false;
        }
        if (this.ˏ == null) {
            this.ॱˊ = 0;
        } else if (this.ॱˊ != 0) {
            if (this.ॱˊ <= uptimeMillis) {
                this.ˏ.setVisible(false, false);
                this.ˏ = null;
                this.ʽ = -1;
                this.ॱˊ = 0;
            } else {
                this.ˏ.setAlpha(((((int) ((this.ॱˊ - uptimeMillis) * 255)) / this.ˋ.ˊˊ) * this.ॱ) / 255);
                z2 = true;
            }
        }
        if (z && r0) {
            scheduleSelf(this.ॱॱ, 16 + uptimeMillis);
        }
    }

    @NonNull
    public Drawable getCurrent() {
        return this.ˊ;
    }

    final void ˎ(Resources resources) {
        this.ˋ.ˏ(resources);
    }

    @RequiresApi(21)
    public void applyTheme(@NonNull Theme theme) {
        this.ˋ.ˎ(theme);
    }

    @RequiresApi(21)
    public boolean canApplyTheme() {
        return this.ˋ.canApplyTheme();
    }

    public final ConstantState getConstantState() {
        if (!this.ˋ.ˊॱ()) {
            return null;
        }
        this.ˋ.ʽ = getChangingConfigurations();
        return this.ˋ;
    }

    @NonNull
    public Drawable mutate() {
        if (!this.ʼ && super.mutate() == this) {
            d ˎ = ˎ();
            ˎ.ˏ();
            ॱ(ˎ);
            this.ʼ = true;
        }
        return this;
    }

    d ˎ() {
        return this.ˋ;
    }

    protected void ॱ(d dVar) {
        this.ˋ = dVar;
        if (this.ʻ >= 0) {
            this.ˊ = dVar.ˊ(this.ʻ);
            if (this.ˊ != null) {
                ˊ(this.ˊ);
            }
        }
        this.ʽ = -1;
        this.ˏ = null;
    }

    static int ˎ(@Nullable Resources resources, int i) {
        int i2 = resources == null ? i : resources.getDisplayMetrics().densityDpi;
        return i2 == 0 ? 160 : i2;
    }
}
